#include<bits/stdc++.h>
using namespace std;
class CustomStack {
public:
    vector<int> st;
    int tp;
    CustomStack(int maxSize) {
        tp=maxSize;
    }
    
    void push(int x) {
        if(st.size()!=tp) st.push_back(x);
    }
    
    int pop() {
        if(st.empty()) return -1;
        int k=st.back();
        st.pop_back();
        return k;
    }
    
    void increment(int k, int val) {
        for(int i=0;i<k&&i<st.size();i++)
        {
            st[i]+=val;
        }
    }
};

/**
 * Your CustomStack object will be instantiated and called as such:
 * CustomStack* obj = new CustomStack(maxSize);
 * obj->push(x);
 * int param_2 = obj->pop();
 * obj->increment(k,val);
 */